package com.test.model;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.Writable;

public class Address implements Writable {
    public String city;
    public String street;
    public int doorplate;
 
    public Address() {
        this("", "", 0);
    }
 
    public Address(String city, String street, int doorplate) {
        this.city = city;
        this.street = street;
        this.doorplate = doorplate;
    }
 
    @Override
    public void write(DataOutput out) throws IOException {
        out.writeUTF(this.city);
        out.writeUTF(this.street);
        out.writeInt(this.doorplate);
    }
 
    @Override
    public void readFields(DataInput in) throws IOException {
        this.city = in.readUTF();
        this.street = in.readUTF();
        this.doorplate = in.readInt();
    }
 
    public String toString() {
        return this.city + "," + this.street + "," + this.doorplate;
    }
}
